package com.ljx.genericity.genericity03;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/10/25 16:09
 * @Version 1.0
 */
public class Test {
	public static void main(String[] args) {
		Ljx<Integer> ljx = new Ljx<>();
		ljx.setE(1);
		ljx.setT(2);
		System.out.println(ljx);

		Ljx<Number> ljx1 = new Ljx<>();
		ljx1.setE(3);
		ljx1.setT(4);
		System.out.println(ljx1);
	}
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class Ljx<T extends Number>{
	// 受上限泛型 <T extends Number> new 此类对象时，他的参数一定是这个受限泛型类型的子类或者本身，

	private T t;
	private T e;

	public void doSome(){
		System.out.println("t = " + t);
		System.out.println("e = " + e);
	}
}
